from tasks.celery import celery
import subprocess

@celery.task
def crawl_lims(pages: str, all: str):
    # 构建命令行参数
    command = ['scrapy', 'crawl', 'project']
    # 添加自定义参数
    command.extend(['-a', f'pages={pages}'])
    command.extend(['-a', f'all={str(all).lower()}'])
    # 执行命令
    subprocess.run(command)
